package genhandle

import (
	"fginTpl/fgin_grpc_gen/config"
	"fginTpl/fgin_grpc_gen/globals"
	"fginTpl/utils"
	"path/filepath"
)

// 生成proto文件
func GenPb() {
	tplParams := map[string]string{
		"ProjectName": config.ConfigData.ProjectName,
		"Port":        config.ConfigData.Port,
		"PrjPascal":   utils.SnakeToPascal(config.ConfigData.ProjectName),
	}
	// 生成proto 文件
	if err := utils.TourchFile(filepath.Join(globals.BASEDIR, "./pb/"+config.ConfigData.ProjectName+"_pb.proto"), "./fgin_grpc_templates/pb/example_grpc_pb.tpl", "pbProtoTpl", tplParams); err != nil {
		panic(err)
	}
}
